<?php

/**
 * @Author: Wang Chunsheng 2192138785@qq.com
 * @Date:   2020-03-15 00:14:57
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2020-06-03 09:05:34
 */
use common\helpers\ImageHelper;
use yii2mod\editable\EditableColumn as EditableEditableColumn;
use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\modules\diandi_shop\models\searchs\DdShopAreas */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '配送点';
$this->params['breadcrumbs'][] = $this->title;
?>
<?= $this->render('_tab'); ?>

<div class="firetech-main">


    <div class="dd-shop-areas-index ">
        <div class="panel panel-default">
            <div class="box-body table-responsive">
                <?= GridView::widget([
                    'dataProvider' => $dataProvider,
                    'filterModel' => $searchModel,
                    'columns' => [
                        ['class' => 'yii\grid\SerialColumn'],
                        'logo' => [
                            'attribute' => 'logo',
                            'format' => ['raw'],
                            'value' => function ($model) {
                                $images = $model->logo;
                                // return $ai_group_status;
                                return Html::img(ImageHelper::tomedia($images), ['width' => 100, 'height' => 'auto']);
                            },
                        ],
                        // 'area_id',
                        'area_name',
                        // 'create_time:datetime',
                        'address',
                        [
                            'class' => EditableEditableColumn::class,
                            'attribute' => 'is_default',
                            'url' => ['setdefault'],
                            'type' => 'select',
                            'editableOptions' => function ($model) {
                                return [
                                    'source' => [0 => '否', 1 => '是'],
                                    'value' => $model->is_default ? '是' : '否',
                                ];
                            },
                            'value' => function ($model) {
                                return $model->is_default ? '是' : '否';
                            },
                        ],
                        //'status',
                        //'freight',
                        //'province_id',
                        //'city_id',
                        //'region_id',

                        ['class' => 'common\components\ActionColumn'],
                    ],
                ]); ?>


            </div>
        </div>
    </div>
</div>